package cn.tedu.boot61.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

@RestController
public class UserController {

    @RequestMapping("/login")
    public int login(String username, String password, String rem,
                     HttpServletResponse response){
        if (username.equals("tom")&&password.equals("123456")){
            if(rem!=null){
                Cookie c1 = new Cookie("username",username);
                Cookie c2 = new Cookie("password",password);
                response.addCookie(c1);
                response.addCookie(c2);
            }

            return 1;
        }
        return 0;
    }
}
